// 暂时利用cookie 缓存，设置主题
import Cookies from 'js-cookie'

const themeName = 'cj-theme-name' 

export function getThemeName() {
  return Cookies.get(themeName)
}

export function setThemeName(setName) {
  return Cookies.set(themeName, setName)
}

export function removeTheme() {
  return Cookies.remove(themeName)
}

export function initSetTheme(){
    let getName = getThemeName() || 'default';     
    changeTheme(getName);
    return getName;
}

export function changeTheme(setName='default'){
    let $body = document.body;
    // let themeName =  Math.random()<0.5?'theme-red':''; 
    $body.className = setName; 
    setThemeName(setName)
}